home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Moscow ML 1.42 / src / test / ovlfail.sml < prev    next >
Encoding:
Text File  |  1997-08-18  |  1.4 KB  |  42 lines  |  [TEXT/R*ch]

  1. (* ovlfail.sml 
  2.    Test of failing  overloading resolution as per the New Definition.
  3.  *  PS 1996-04-12
  4.  *)
  5.  
  6. type word8 = Word8.word;
  7.  
  8. fun fail1 (x : 'a) = x + x;
  9. fun fail2 (x as (a,b,c)) = x + x;
  10. fun fail3 (x : bool -> bool) = x + x;
  11. fun fail4 (x : bool) = x + x;
  12. fun fail5 (x : int Array.array) = x + x;
  13. fun fail6 x = abs x before ignore (x + 0w0);
  14. fun fail7 x = ~ x before ignore (x + 0w0);
  15. fun fail8 x y = x div y before ignore (y + 0.0);
  16. fun fail9 x y = x mod y before ignore (y + 0.0); 
  17. fun fail10  x y = x + y before ignore (y ^ "");
  18. fun fail11  x y = x - y before ignore (y ^ "");
  19. fun fail12 x y = x * y before ignore (y ^ "");
  20. fun fail13 x y = x div y before ignore (y ^ "");
  21. fun fail14 x y = x mod y before ignore (y ^ ""); 
  22. fun fail15 x = abs x before ignore (x ^ "");
  23. fun fail16 x = ~ x before ignore (x ^ "");
  24. fun fail17  x y = x + y before ignore (ord y);
  25. fun fail18  x y = x - y before ignore (ord y);
  26. fun fail19 x y = x * y before ignore (ord y);
  27. fun fail20 x y = x div y before ignore (ord y);
  28. fun fail21 x y = x mod y before ignore (ord y); 
  29. fun fail22 x = abs x before ignore (ord x);
  30. fun fail23 x = ~ x before ignore (ord x);
  31. fun fail24 x = abs x before ignore (x + 0w0 : word8);
  32. fun fail25 x = ~ x before ignore (x + 0w0 : word8);
  33. val fail26 = 0w1 : int;
  34. val fail27 = 0w1 : real;
  35. val fail28 = 0w1 : string;
  36. val fail29 = 0w1 : char;
  37. val fail30 = 0w1 : bool;
  38. val fail31 = 0w1 : int Array.array;
  39. fun fail32 (x as 0w256) = [x, x, x, 0w0 : word8]
  40.   | fail32 _ = [];
  41.  
  42.